<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', 'PagesController@root')->name('root');
Route::get('/test', 'PagesController@test')->name('test');
Route::any('/callback', 'WeChatController@serve');
// 授权页面
Route::get('/redirect', 'WeChatController@redirect')->name('redirect');

// 授权回调
//Route::get('/callback', 'WeChatController@callback')->name('callback');

Route::middleware('wechat.oauth:oauth:snsapi_base')->group(function () {
    Route::get('/', 'WeChatController@autoRegister')->name('register');
});
//Route::group(['middleware' => ['web', 'wechat.oauth']], function () {
    Route::get('/user', function () {
        $user = session('wechat.oauth_user.default'); // 拿到授权用户资料
        return $user;
        dd($user.'123');
    });
//});

Route::any('/wechat', 'WeChatController@serve');
// $width, $height
Route::get('/makeDoor/{width}/{height}', 'DesignPattern\Creational\SimpleFactory\WoodenDoorController@makeDoor');
Route::get('/MarketingManager', 'DesignPattern\Creational\FactoryMethod\ManagerController@MarketingManager');
Route::get('/DevelopmentManager', 'DesignPattern\Creational\FactoryMethod\ManagerController@DevelopmentManager');
Route::get('/door', 'DesignPattern\Creational\AbstractFactory\DoorController@index');
Route::get('/bridge', 'DesignPattern\Creational\Structural\BridgeController@index');
Route::get('/decorator', 'DesignPattern\Creational\Structural\DecoratorController@index');
Route::get('/facade', 'DesignPattern\Creational\Structural\FacadeController@index');
Route::get('/proxy/{password}', 'DesignPattern\Creational\Structural\ProxyController@index');
Route::get('/chain_of_responsibility', 'DesignPattern\Creational\Behavioral\ChainOfResponsibilityController@index');
Route::get('/command', 'DesignPattern\Creational\Behavioral\CommandController@index');
Route::get('/state', 'DesignPattern\Creational\Behavioral\StateController@index');
Route::get('/strategy', 'DesignPattern\Creational\Behavioral\StrategyController@index');
Route::get('/visitor', 'DesignPattern\Creational\Behavioral\VisitorController@index');
Route::get('/template_method', 'DesignPattern\Creational\Behavioral\TemplateMethodController@index');
Route::get('/burger/{name}', 'DesignPattern\Creational\Builder\BurgerController@index');

//Auth::routes();
//
//Route::get('/home', 'HomeController@index')->name('home');
// 富文本编辑器上传图片
Route::post('/admin/editor/upload_img','UploadeController@upload_img_for_ckeditor4');
